package com.tql.mall.search.client;

import com.tql.mall.model.search.SearchParam;
import com.tql.mall.model.search.SearchRespVo;
import com.tql.mall.search.client.impl.SearchDegradeFeignClient;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Author: tyk
 * @Date: 2023/5/23 20:24
 * @Description:
 */
@FeignClient(value = "service-search", fallback = SearchDegradeFeignClient.class)
public interface SearchFeignClient {
    /**
     * 创建索引库
     */
    @GetMapping("api/search/inner/createIndex")
    public Boolean createIndex();


    /**
     * 商品上架
     */
    @GetMapping("api/search/inner/onSale/{skuId}")
    public Boolean onSale(@PathVariable Long skuId);

    /**
     * 商品下架
     */
    @GetMapping("api/search/inner/offSale/{skuId}")
    public Boolean offSale(@PathVariable Long skuId);

    /**
     * 增加热度
     */
    @GetMapping("api/search/inner/incrHotScore/{skuId}")
    public Boolean incrHotScore(@PathVariable Long skuId);


    /**
     * 搜索
     */
    @PostMapping("api/search/inner/search")
    SearchRespVo search(@RequestBody SearchParam searchParam);
}
